#include "playersetup.h"
#include <QLabel>
#include <QLineEdit>
#include <QRadioButton>
#include <QHBoxLayout>

PlayerSetup::PlayerSetup(bool human, QWidget *parent) : QWidget(parent)
{
	m_nameEdit = new QLineEdit();
	m_nameLabel = new QLabel("Name:");
	m_HumanRadio = new QRadioButton("&Human");
	m_ComputerRadio = new QRadioButton("&Computer");
	if (human) {
		m_HumanRadio->setChecked(true);
	} else {
		m_ComputerRadio->setChecked(true);
	}
	
	QHBoxLayout *layout = new QHBoxLayout;
	layout->addWidget(m_nameLabel);
	layout->addWidget(m_nameEdit);
	layout->addWidget(m_HumanRadio);
	layout->addWidget(m_ComputerRadio);
	
	setLayout(layout);
}

const QString &PlayerSetup::getName() const
{
	return m_nameEdit->text();
}

bool PlayerSetup::getComputer() const
{
	return m_ComputerRadio->isChecked();
}
